package rdd01.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark_RDD_Transform_Map {
  def main(args: Array[String]): Unit = {
    val sparkConf=new SparkConf().setMaster("local[*]").setAppName("Operation")
    val sc=new SparkContext(sparkConf)
    val rdd=sc.textFile("data")
    val mapRDD:RDD[String] = rdd.map(
      line => {
        val datas = line.split(" ")
        datas(6)
      }
    )
    mapRDD.collect.foreach(println)
    val rdd1=sc.makeRDD(List(1,2,3,4),3)
    val mpRDD1:RDD[Int] = rdd1.mapPartitions(
      iter => {
        println(">>>>>>")
        iter.map(_ * 2)
      }
    )
    mpRDD1.collect().foreach(println)
    sc.stop()

  }

}
